package ClassExercise1;

import java.io.*;

//使用readLine读取数据
public class Exercise1 {
    public static void main(String[] args) {
        BufferedReader iso = null;
        BufferedWriter isw = null;
        //1：造文件，造流
        try {
            FileReader file1 = new FileReader(new File("C:\\Users\\Administrator\\Desktop\\1.txt"));
            FileWriter file2 = new FileWriter(new File("C:\\Users\\Administrator\\Desktop\\3.txt"));

             iso = new BufferedReader(file1);
             isw = new BufferedWriter(file2);
            char [] arr = new char[1024];
            int date;
            while((date = iso.read(arr))!=-1){
                isw.write(arr,0,date);
                isw.flush();
            }
            /*
            *
            *String date;
            * while((date=isw.readLine())!=null){
            * bw.writer(date);
            * bw.newLine();
            * }
            *
            * */
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            if(iso!=null){
                try {
                    iso.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            if(isw!=null){
                try {
                    isw.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }

    }
}
